clear all


use "final_replication_data.dta", clear


set more off





****************************
*
*  Key Results in Appendix
*
****************************

*** Table 5 ****


reghdfe  ln_flow_m barrier_m barr_time dem_dyad ally_def rivalry_M terr_dispute ln_gdppc_ratio if alldir==0, absorb(c1year c2year ddyad) cluster(dyad)

estimates store mT1, title(Model 1)

reghdfe  ln_flow_m barrier_m barr_time dem_dyad ally_def rivalry_M terr_dispute ln_gdppc_ratio ptadum_new comcur bothin_m if alldir==0, absorb(c1year c2year ddyad) cluster(dyad)

estimates store mT1b, title(Model 1b)

reghdfe  ln_flow_m barrier_m##postcoldwar dem_dyad ally_def rivalry_M terr_dispute ln_gdppc_ratio if alldir==0, absorb(c1year c2year ddyad) cluster(dyad)

estimates store mT2, title(Model 2)

reghdfe  ln_flow_m barrier_m##postcoldwar dem_dyad ally_def rivalry_M terr_dispute ln_gdppc_ratio ptadum_new comcur bothin_m if alldir==0, absorb(c1year c2year ddyad) cluster(dyad)

estimates store mT2b, title(Model 2b)

estout mT1 mT1b mT2 mT2b, style(tex) starlevels(* 0.10 ** 0.05) cells(b(star fmt(3)) se(par fmt(2))) stats(N) 


*** Table 6 ****


ppml_panel_sg raw_importflow barrier_case barrier_m dem_dyad ally_def rivalry_M if alldir==1, importer(ccode1) exporter(ccode2) y(year) clus(dyad)

estimates store m3_1, title(Model 1)

ppml_panel_sg raw_importflow barrier_case barrier_m dem_dyad ally_def rivalry_M ptadum_new comcur bothin_m if alldir==1, importer(ccode1) exporter(ccode2) y(year) clus(dyad)

estimates store m3_2, title(Model 2)

ppml_panel_sg raw_importflow contig_barrierneighbors barrier_m dem_dyad ally_def rivalry_M if alldir==1, importer(ccode1) exporter(ccode2) y(year) clus(dyad)

estimates store m3_3, title(Model 3)

ppml_panel_sg raw_importflow contig_barrierneighbors barrier_m dem_dyad ally_def rivalry_M ptadum_new comcur bothin_m if alldir==1, importer(ccode1) exporter(ccode2) y(year) clus(dyad)

estimates store m3_4, title(Model 4)

estout m3_1 m3_2 m3_3 m3_4, style(tex) starlevels(* 0.10 ** 0.05) cells(b(star fmt(3)) se(par fmt(2))) stats(N) 


*** Table 7 ***



ppml_panel_sg raw_importflow contig_nobarrier contig_barrier ln_distance dem_dyad ally_def rivalry_M logprodGDP, importer(ccode1) exporter(ccode2) y(year) nopair clus(dyad) tolerance(1e-10) maxiter(12000)      

estimates store m2_3, title(Model 4)

ppml_panel_sg raw_importflow contig_nobarrier contig_barrier ln_distance dem_dyad ally_def rivalry_M ptadum_new comcur logprodGDP, importer(ccode1) exporter(ccode2) y(year) nopair clus(dyad) tolerance(1e-10) maxiter(12000)      

estimates store m2_4, title(Model 5)


ppml_panel_sg raw_importflow contig_nobarrier pre_barr_contig ln_distance dem_dyad ally_def rivalry_M logprodGDP, importer(ccode1) exporter(ccode2) y(year) nopair clus(dyad) tolerance(1e-10) maxiter(12000)      

estimates store m2_7, title(Model 7)

ppml_panel_sg raw_importflow contig_nobarrier pre_barr_contig ln_distance dem_dyad ally_def rivalry_M ptadum_new comcur logprodGDP, importer(ccode1) exporter(ccode2) y(year) nopair clus(dyad) tolerance(1e-10) maxiter(12000)      

estimates store m2_8, title(Model 8)

estout m2_3 m2_4 m2_7 m2_8, style(tex) starlevels(* 0.10 ** 0.05) cells(b(star fmt(3)) se(par fmt(2))) stats(N) 


*** Table 11 ***


ppml_panel_sg raw_importflow contig_barrierneighbors barrier_m dem_dyad ally_def rivalry_M if alldir==1, importer(ccode1) exporter(ccode2) y(year) clus(dyad)

estimates store m3_5, title(Model 5)

ppml_panel_sg raw_importflow contig_barrierneighbors barrier_m dem_dyad ally_def rivalry_M ptadum_new comcur bothin_m if alldir==1, importer(ccode1) exporter(ccode2) y(year) clus(dyad)

estimates store m3_6, title(Model 6)


** Proxy for economic disparity with neighbor **


gen contbarrnei_gdprat= contig_barrierneighbors*gdppc_rat


ppml_panel_sg raw_importflow contbarrnei_gdprat contig_barrierneighbors gdppc_rat barrier_m dem_dyad ally_def rivalry_M if alldir==1, importer(ccode1) exporter(ccode2) y(year) clus(dyad)

estimates store m3_7, title(Model 7)


ppml_panel_sg raw_importflow contbarrnei_gdprat contig_barrierneighbors gdppc_rat barrier_m dem_dyad ally_def rivalry_M ptadum_new comcur bothin_m if alldir==1, importer(ccode1) exporter(ccode2) y(year) clus(dyad)

estimates store m3_8, title(Model 8)

estout m3_5 m3_6 m3_7 m3_8, style(tex) starlevels(* 0.10 ** 0.05) cells(b(star fmt(3)) se(par fmt(2))) stats(N) 




*** Table 12 ***


ppml_panel_sg raw_importflow ag_wall_m  dem_dyad ally_def rivalry_M gdppc_rat if alldir==1, importer(ccode1) exporter(ccode2) y(year)  clus(dyad) tolerance(1e-10) maxiter(12000)      

estimates store i_1, title(Model 3)

ppml_panel_sg raw_importflow ag_wall_m  dem_dyad ally_def rivalry_M ptadum_new comcur bothin_m gdppc_rat if alldir==1, importer(ccode1) exporter(ccode2) y(year)  clus(dyad) tolerance(1e-10) maxiter(12000)      

estimates store i_2, title(Model 4)


ppml_panel_sg raw_importflow hw_wall_m  dem_dyad ally_def rivalry_M gdppc_rat if alldir==1, importer(ccode1) exporter(ccode2) y(year)  clus(dyad) tolerance(1e-10) maxiter(12000)      

estimates store i_3, title(Model 3)

ppml_panel_sg raw_importflow hw_wall_m  dem_dyad ally_def rivalry_M ptadum_new comcur bothin_m gdppc_rat if alldir==1, importer(ccode1) exporter(ccode2) y(year)  clus(dyad) tolerance(1e-10) maxiter(12000)      

estimates store i_4, title(Model 4)


estout i_1 i_2 i_3 i_4, style(tex) starlevels(* 0.10 ** 0.05) cells(b(star fmt(3)) se(par fmt(2))) stats(N) 


*********************
*
* Produce Figure 1
*
*********************

* demonstrate that unlogged measure highly skewed 

kdensity gdppc_rat

kdensity unlogged_gdprat


***********************************************
*
***     Oster Sensitivity Test Results      ***
*
***********************************************


******* Models to Examine *******

******* NOTE: These are used for comparison of coefficients and to identify the samples to be used, to ensure comparability with the results in the article *******
******* NOTE 2: Due to the different estimation strategy for the country-year fixed effects here and below, where we implement Oster's test, the exact estimates will be slightly different *******


reghdfe  ln_flow_m barrier_m dem_dyad ally_def, absorb(c1year c2year ddyad) cluster(dyad)

gen sampleB=e(sample)

estimates store mOT_B, title(Model 0)


reghdfe  ln_flow_m barrier_m dem_dyad ally_def rivalry_M terr_dispute, absorb(c1year c2year ddyad) cluster(dyad)

gen sample0=e(sample)

estimates store mOT_1, title(Model 1)


reghdfe  ln_flow_m barrier_m dem_dyad ally_def rivalry_M terr_dispute ln_gdppc_ratio, absorb(c1year c2year ddyad) cluster(dyad)

gen sample1=e(sample)

estimates store mOT_2, title(Model 2)


reghdfe  ln_flow_m barrier_m dem_dyad ally_def rivalry_M terr_dispute ptadum_new comcur ln_gdppc_ratio bothin_m, absorb(c1year c2year ddyad) cluster(dyad)

gen sample2=e(sample)

estimates store mOT_3, title(Model 3)


estout mOT_1 mOT_2 mOT_3, style(tex) starlevels(* 0.10 ** 0.05) cells(b(star fmt(3)) se(par fmt(2))) stats(N) 


sort c1year

by c1year: center ln_flow_m barrier_m dem_dyad ally_def rivalry_M terr_dispute ln_gdppc_ratio ptadum_new comcur bothin_m


sort c2year

by c2year: center c_ln_flow_m-c_bothin_m



xtset ddyad

*xtreg c_c_ln_flow_m c_c_barrier_m if samp==1, fe

xtreg c_c_ln_flow_m c_c_barrier_m c_c_dem_dyad c_c_ally_def if sampleB==1, fe


psacalc beta c_c_barrier_m, rmax(0.00962)

psacalc delta c_c_barrier_m, rmax(0.00962)

psacalc beta c_c_barrier_m, rmax(.0222)

psacalc delta c_c_barrier_m, rmax(.0222)

psacalc beta c_c_barrier_m, rmax(.037)

psacalc delta c_c_barrier_m, rmax(.037)

psacalc beta c_c_barrier_m, rmax(.074)

psacalc delta c_c_barrier_m, rmax(.074)


xtreg c_c_ln_flow_m c_c_barrier_m c_c_dem_dyad c_c_ally_def c_c_rivalry_M c_c_terr_dispute if sample0==1, fe


psacalc beta c_c_barrier_m, rmax(.01326)

psacalc delta c_c_barrier_m, rmax(.01326)

psacalc beta c_c_barrier_m, rmax(.0306)

psacalc delta c_c_barrier_m, rmax(.0306)

psacalc beta c_c_barrier_m, rmax(.051)

psacalc delta c_c_barrier_m, rmax(.051)

psacalc beta c_c_barrier_m, rmax(.102)

psacalc delta c_c_barrier_m, rmax(.102)


xtreg c_c_ln_flow_m c_c_barrier_m c_c_dem_dyad c_c_ally_def c_c_rivalry_M c_c_terr_dispute c_c_ln_gdppc_ratio if sample1==1, fe



psacalc beta c_c_barrier_m, rmax(.01261)

psacalc delta c_c_barrier_m, rmax(.01261)

psacalc beta c_c_barrier_m, rmax(.0291)

psacalc delta c_c_barrier_m, rmax(.0291)

psacalc beta c_c_barrier_m, rmax(.0485)

psacalc delta c_c_barrier_m, rmax(.0485)


psacalc beta c_c_barrier_m, rmax(.097)

psacalc delta c_c_barrier_m, rmax(.097)


